
import { CheckBox } from "devextreme-react";
import moment from "moment";

export const accountAdjustCol = [
  {
    dataField: "XH",
    dataType: "string",
    caption: "序号",
    width: 90,
    alignment: "center",
    headerFilter: {
      dataSource: [{
        text: '序号小于1000',
        value: ['XH', '<', 1000],
      },
      {
        text: '序号1000至10000',
        value: [['SaleAmount', '>=', 1000], ['SaleAmount', '<', 10000]],
      },
      {
        text: '序号大于10000',
        value: ['XH', '>=', 10000],
      }],
    },
    // cellRender: (cell: any) => {
    //   return cell.rowIndex
    // }
  },
  // {
  //   dataField: "Remarks",
  //   dataType: "string",
  //   caption: "调整说明",
  //   width: 200,
  //   alignment: "left",
  //   // cellRender: (cell: any) => {
  //   //   console.log(cell, '----celll');
  //   // }
  // },
  {
    dataField: "ItemNames3",
    dataType: "string",
    caption: "报表项目",
    width: 200,
    alignment: "left",
  },
  {
    dataField: "YSKMBH",
    dataType: "string",
    caption: "科目编号",
    width: 200,
    alignment: "left",
  },
  {
    dataField: "KMMC",
    dataType: "string",
    caption: "科目名称",
    width: 200,
    alignment: "left",
  },
  {
    dataField: "HSXMMC",
    dataType: "string",
    caption: "辅助账名称",
    width: 200,
    alignment: "left",
  },
  {
    dataField: "JF",
    caption: "借方金额",
    width: 80,
    alignment: "right",
    dataType: "number",
    dataTypeCustom: "money-number",
    // format: { type: 'decimal', currency: 'CNY', precision: 2 }
  },
  {
    dataField: "DF",
    caption: "贷方金额",
    width: 80,
    alignment: "right",
    dataType: "number",
    dataTypeCustom: "money-number",
    // format: { type: 'decimal', currency: 'CNY', precision: 2 }
    // editorOptions: {
    //   format: { type: 'decimal', currency: 'CNY', precision: 2 }
    // },
  },
  {
    dataField: "Remark",
    dataType: "string",
    caption: "备注",
    width: 120,
    alignment: "left",
  },
  {
    dataField: "IsJZFL",
    // dataType: "string",
    caption: "结转分录",
    width: 120,
    alignment: "center",
    cellRender: (cell: any) => {
      return <CheckBox value={cell.data.IsJZFL ? true : false} readOnly />
    }
  },
  {
    dataField: "IsTZ",
    dataType: "string",
    caption: "是否调整",
    alignment: "center",
    cellRender: (cell: any) => {
      let strIS = '';
      if (cell.data.IsTZ === 1) {
        strIS = '是'
      } else if (cell.data.IsTZ === 0) {
        strIS = '否'
      }
      return <span>{strIS}</span>
    }
  },
  {
    dataField: "EditUser",
    dataType: "string",
    caption: "编辑人",
    width: 80,
    alignment: "center",
  },
  {
    dataField: "EditDate",
    dataType: "string",
    caption: "编辑时间",
    alignment: "center",
    cellRender: (cell: any) => {
      return <span>{moment.utc(cell.data.EditDate).format('YYYY-MM-DD')}</span>
    }
  },
  // {
  //   dataField: "operation",
  //   dataType: "string",
  //   caption: "行操作",
  //   width: 100,
  //   alignment: "center",
  //   cellRender: (cell: any) => {
  //     return <CpasIcon type='icon-delete' fontSize={16} />
  //   }
  // },
];


export const auditAdjustCol = [

  {
    dataField: "XH",
    dataType: "string",
    caption: "序号",
    width: 90,
    alignment: "center",
    headerFilter: {
      dataSource: [{
        text: '序号小于1000',
        value: ['XH', '<', 1000],
      },
      {
        text: '序号1000至10000',
        value: [['SaleAmount', '>=', 1000], ['SaleAmount', '<', 10000]],
      },
      {
        text: '序号大于10000',
        value: ['XH', '>=', 10000],
      }],
    },
    // cellRender: (cell: any) => {
    //   return cell.rowIndex
    // }
  },
  // {
  //   dataField: "Remarks",
  //   dataType: "string",
  //   caption: "调整说明",
  //   width: 200,
  //   alignment: "left",
  // },
  {
    dataField: "TZLX",
    dataType: "string",
    caption: "调整类型",
    width: 100,
    alignment: "left",
    headerFilter: {
      dataSource: [{
        text: '账项调整',
        value: ['TZLX', '=', 2],
      },
      {
        text: '报表调整',
        value: ['TZLX', '=', 3],
      },
      {
        text: '其他调整',
        value: ['TZLX', '=', 4],
      }],
    },
    cellRender: (cell: any) => {
      let strTZLX: any = '';
      if (cell.data.TZLX === 2) {
        strTZLX = '账项调整'
      } else if (cell.data.TZLX === 3) {
        strTZLX = '报表调整'
      } else if (cell.data.TZLX === 4) {
        strTZLX = '其他调整'
      } else {
        strTZLX = cell.data.TZLX;
      }
      return <span>{strTZLX}</span>
    }
  },
  {
    dataField: "AdjustType",
    dataType: "string",
    caption: "调整分类",
    width: 110,
    alignment: "left",
    cellRender: (cell: any) => {
      let strAdjustType: any = '';
      if (cell.data.AdjustType === 1) {
        strAdjustType = '会计差错更正'
      } else if (cell.data.AdjustType === 2) {
        strAdjustType = '会计政策变更'
      } else if (cell.data.AdjustType === 3) {
        strAdjustType = '其他'
      } else {
        strAdjustType = cell.data.AdjustType;
      }
      return <span>{strAdjustType}</span>
    }
  },
  {
    dataField: "ItemNames3",
    dataType: "string",
    caption: "报表项目",
    width: 200,
    alignment: "left",
  },
  {
    dataField: "YSKMBH",
    dataType: "string",
    caption: "科目编号",
    width: 200,
    alignment: "left",
  },
  {
    dataField: "KMMC",
    dataType: "string",
    caption: "科目名称",
    width: 200,
    alignment: "left",
  },
  {
    dataField: "HSXMMC",
    dataType: "string",
    caption: "辅助账名称",
    width: 200,
    alignment: "left",
  },
  {
    dataField: "JF",
    caption: "借方金额",
    width: 80,
    alignment: "right",
    dataType: "number",
    dataTypeCustom: "money-number",
    // format: { type: 'decimal', currency: 'CNY', precision: 2 }
  },
  {
    dataField: "DF",
    caption: "贷方金额",
    width: 80,
    alignment: "right",
    dataType: "number",
    dataTypeCustom: "money-number",
    // format: { type: 'decimal', currency: 'CNY', precision: 2 }
  },
  {
    dataField: "Remark",
    dataType: "string",
    caption: "备注",
    // width: 120,
    alignment: "left",
  },
  {
    dataField: "IsRetrospect",
    // dataType: "string",
    caption: "仅追溯本期期初",
    width: 120,
    alignment: "center",
  },
  {
    dataField: "IsJZFL",
    // dataType: "string",
    caption: "结转分录",
    width: 120,
    alignment: "center",
    cellRender: (cell: any) => {
      return <CheckBox value={cell.data.isJZFL ? true : false} readOnly />
    }
  },
  {
    dataField: "IsTZ",
    dataType: "string",
    caption: "是否调整",
    // width: 50,
    alignment: "center",
    cellRender: (cell: any) => {
      let strIS = '';
      if (cell.data.IsTZ === 1) {
        strIS = '是'
      } else if (cell.data.IsTZ === 0) {
        strIS = '否'
      }
      return <span>{strIS}</span>
    }
  },
  {
    dataField: "EditUser",
    dataType: "string",
    caption: "编辑人",
    // width: 80,
    alignment: "center",
  },
  {
    dataField: "EditDate",
    dataType: "string",
    caption: "编辑时间",
    // width: 100,
    alignment: "center",
    cellRender: (cell: any) => {
      return <span>{moment.utc(cell.data.EditDate).format('YYYY-MM-DD')}</span>
    }
  },
  // {
  //   dataField: "operation",
  //   dataType: "string",
  //   caption: "行操作",
  //   width: 100,
  //   alignment: "center",
  //   cellRender: (cell: any) => {
  //     return <CpasIcon type='icon-delete' fontSize={16} />
  //   }
  // },
];

